Welcome to RetConvert! This program is a CLI command designed to give you an easy way of converting the return code types of ASCII files. ASCII is a standard, for goodness sake, so this program shouldn't really exist at all. Unfortunately for standardisation, it does!
Basically, there are three types of return codes. They are as follows:
LF (Line Feed) only - This is used by the Amiga, and by UNIX, so why bother with anything else ? Oh, well...
CR (Carriage Return) only - This is only used by the Apple Mac. Well, at least it's got a good old Motorola inside it.
CRLF (Carriage Return with Line Feed) - Typically inefficient PC ASCII format. Naturally, where proper computers only need one code to signify the end of a line, the PC uses two. Lamers!
But why ?
---------
Of course, you're probably wondering why you could possibly wish to lower yourself to using PC and Mac ASCII files, when the Amiga does it several times better. Simply put, some 'miggy owners have little choice, and so when saving their work on the school PC/Mac and taking it home for use with CrossDOS (with Mac, you'd convert it to an MS-DOS disc first), they find that they have to go through the file and edit out all of the strange bits, which is rather time consuming. The process also works the other way round, if you wish to take some Amiga stuff in for printing.
Using RetConvert
----------------
To use RetConvert, simply type RetConvert, followed by either a
question mark (?), or HELP, or without any parameters. You should then see...
The <Input File> bit is mandatory (as if you didn't know -if you didn't, throw away your PC, and try again!). [Output File] is optional. If you don't specify one, the source file will be overwritten, so BE CAREFUL! Finally, the return type is either LF,
CRLF, or CR to indicate what format you want the ouput to be in. Note that you can use LFCR as a synonym for CRLF, both produce the same results (as Carriage Return is placed BEFORE Line Feed). There is no reason why you would wish to place Line Feed first (if you can prove otherwise, let me know!).
Some PC ASCII formats (in typical PC style, nothing is certain -other than the fact that PC owners can't tell the difference between a fancy launching application, and a proper Operating System!) contain a little character at the very end of the file as
a sort of End-Of-File signal. Fair enough, but although it's usually a Line Feed, I've seen it as other things. Retconvert will
check the last byte of the file (if it is in CRLF format), and will alter it if it is found to be an unprintable character (ie. and ASCII code of less than 32). This appears to cover the dodgy situations.
How does it work ?
------------------
RetConvert simply loads the whole input file into memory, and attempts to ascertain the file format. If all that succeeds, it will begin writing out a destination file (or overwriting the original, depending on what you choose). It's as simple as that!
Errors
------
There are very few error messages generated by the program. They are mainly pretty self-explanitory, but I'll explain them anyway. Here goes...
Required argument missing - You've specified too few input parameters. The minimum is two (Input File, Return Type).
Wrong number of arguments - You've specified too many input parameters. There are a maximum of three (Input File, Output File,
and Return Type).
Invalid return code type - You've made some kind of typo in the
Return Type field. Acceptable types are LF, CRLF (or LFCR), and CR (case insensitive).
Unable to identify input file: No return codes found - You have
given the program a file to convert which contains no return codes
at all. Note that this program should only be used with ASCII files, so if you have put a Deluxe Paint picture through it, you may well get this error.
No conversion necessary: File is already set to specified return codes - If RetConvert identifies the format of the input file as being the same as the type you wish to convert it to, there's no point in doing the conversion. It's as simple as that.
Unable to read input file - This usually means that the input file does not exist, but due to the general nature of C++ file handling, it could also mean that a file is read-protected or something.
Unable to access file length information - RetConvert will try to ascertain the length of the file in order to allocate enough memory to load the whole file (primarily for speed. If the Operating System won't allow RetConvert to find the length of the file. This error seems highly unlikely to occur, but anything is possible, I suppose.
Insufficient memory to load source file - To cut a long story short, you haven't got enough memory to load the whole file into memory. I'm afraid that this will mean shutting down those greedy applications, nicking bitplanes from Workbench (Ouch! Naughty!), and switching off those external disc drives. If this doesn't fix the problem, reset your machine (to defragment the memory) and try again. The expensive alternative is to nip down to the shops and buy a RAM expansion.
Unable to write output file - This can be caused by lack of disc space on the destination disc, or if you are overwriting a file which is protected from writing/deletion (including a write-protected disc).
And finally...
--------------
This is my first C++ program on the Aminet (come to think of it, it's my first on the Amiga!), but it's my second on the Aminet (AutoAppMenu was the first). Admittedly, I HATE C/C++, as the equivalent program in AMOS took about five minutes to write, when this took ages. Bloody include files! It's developed entirely on the Amiga using SAS/C V6.55. I've made it nice and portable, so it can be stuck on UNIX, but I'm not giving away any source code, just in case anyone produces a PC version. No way! An assembly language version would be quite nice, and significantly smaller (take a peek at the Util/App drawer on Aminet for a program called "AutoAppMenu" - 100% assembly language, and only 7K -shame that it's crap, though!).
Andrew Elia
E-Mail: odin@dcs.qmw.ac.uk
Long Live the Amiga! Death to the PC, and to all who own one!